﻿using System;

namespace GreetingCreatorGraphicUserControls.BackgroundAnimationCustomControl
{
    public static class RandomService
    {
        private static readonly Random _random = new Random();

        public static int RandomNumber(int minValue, int maxValue)
        {
            return (_random.Next(minValue, maxValue));
        }

        public static int GetRandomCenterX()
        {
            int startX = 0;
            int endX = 80;
            return _random.Next(startX, endX);
        }

        public static int GetRandomAngle()
        {
            int startAngle = 5;
            int endAngle = 820;
            return _random.Next(startAngle, endAngle);
        }

        public static double GetValidRandomObjectScaleSize()
        {
            int minSize = 060;
            int maxSize = 200;
            string scaleRandomDecimalNumber = _random.Next(minSize, maxSize).ToString("#000");

            Double objctScaleSize;
            Double.TryParse("0." + scaleRandomDecimalNumber, out objctScaleSize);
            return objctScaleSize;
        }

        internal static double RandomDuration(double minDuration, double maxDuration)
        {
            return (Double.Parse(RandomNumber(Convert.ToInt32(minDuration), Convert.ToInt32(maxDuration)) + ".0"));
        }
    }
}